package com.sugon.entity.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.sugon.entity.SysDeptEntity;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@NoArgsConstructor
@Data
public class UViewSelectOptionDTO implements Serializable {

    /**
     * label
     */
    private String label;

    /**
     * value
     */
    private String value;

    /**
     * 父id ，根节点为0
     */
    @JsonIgnore
    public String parentId;

    /**
     * children
     */
    private List<UViewSelectOptionDTO> children;

    /**
     * 构造方法
     *
     * @param dept
     */
    public UViewSelectOptionDTO(SysDeptEntity dept) {
        this.label = dept.getName();
        this.value = dept.getDeptId();
        this.parentId = dept.getParentId();
    }
}
